package com.gxgy.app.task;

import com.gxgy.app.doman.po.Order;
import com.gxgy.app.mapper.OrderMapper;

public class OrderTask implements Runnable{

    private Order order;
    private OrderMapper orderMapper;

    public OrderTask(Order order, OrderMapper orderMapper) {
        this.order = order;
        this.orderMapper = orderMapper;
    }

    @Override
    public void run() {
        try {
            // 等待10秒
            Thread.sleep(10000);
            this.order.setStatus(this.order.getStatus() + 1);
            this.orderMapper.updateById(this.order);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
